class Event < ActiveRecord::Base
  belongs_to :users
  has_many :tasks,:order=>'updated_at desc'
  def self.type_list
    ["work","study","life","funny","skill","personal","part-time-job"]
  end
  def self.priority_list
    ['none','low','low-medium','medium','high','urgent']
  end
  def priority_text
    Event.priority_list[self.priority]
  end
  def last_task
    if tasks
      tasks[0]
    else
      nil
    end
  end
end
